Skip to content

Conversation

piinthecloud
Copy link
Contributor

This PR enhances the WooCommerce Code Reference Generator to support local development workflows by and improving the recursive file scanning to detect hooks in woocommerce/src and deeper subdirectories.

Expanded file parsing

Added woocommerce/src to parsed files: The logic in generate-hook-docs.php has been updated to know also look inside woocommerce/src to detect hooks and filters in use.

Fixed generate-hook-docs.php recursion: During testing, I detected that the getFiles() function wasn't going deep enough into the directories to appropriately retrieve all hook references. I simplified the logic on line 113 to directly merge the files from each subdirectory directly into the $files array.

Hook and filter detection: Increased from 1,732 to 2,580 hooks.

Local development

To facilitate development, I've added the run-local.sh which lets you easily set up a local server with a local copy of the docs.

Tweaks

Updated the .gitignore to ensure linked /woocommerce files never get committed.

@piinthecloud piinthecloud requested review from jorgeatorres, bacoords and a team and removed request for bacoords July 23, 2025 12:40
Copy link

@bacoords bacoords left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the local environment didn't work for me - it comes up but it doesn't have any of the actual file references. This isn't critical if you know it's working for you, but maybe we should screenshare to confirm.

Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @piinthecloud!

Thanks for the PR 💯. It works beautifully and I can confirm that the missing hooks are now present in the docs.

As for the local script, I left some small suggestions. Nothing's really a blocker, though. Please let me know what you think! Thanks again!

@jorgeatorres jorgeatorres self-requested a review July 25, 2025 16:38
@piinthecloud
Copy link
Contributor Author

@jorgeatorres any additional concerns?

Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This works great. Thank you @piinthecloud and apologies for the delay in finishing the review!

@jorgeatorres jorgeatorres merged commit 3692ab7 into trunk Aug 5, 2025
@jorgeatorres jorgeatorres deleted the fix/fix-missing-hook-references branch August 5, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants